#region File Description
//-----------------------------------------------------------------------------
// Game.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace Stickman2D
{
	/// <summary>
	/// Sample showing how to manage different game states, with transitions
	/// between menu screens, a loading screen, the game itself, and a pause
	/// menu. This main game class is extremely simple: all the interesting
	/// stuff happens in the ScreenManager component.
	/// </summary>
	public class GameStateManagementGame : Microsoft.Xna.Framework.Game
	{
		#region Fields

		GraphicsDeviceManager graphics;
		ScreenManager screenManager;
		SpriteManager spriteManager;

		// By preloading any assets used by UI rendering, we avoid framerate glitches
		// when they suddenly need to be loaded in the middle of a menu transition.
		static readonly string[] preloadAssets =
        {
            "gradient",
        };


		#endregion

		#region Initialization


		/// <summary>
		/// The main game constructor.
		/// </summary>
		public GameStateManagementGame()
		{
			Content.RootDirectory = "Content";

			graphics = new GraphicsDeviceManager(this);
			//Initialize screen size to an ideal resolution for the XBox 360
			graphics.PreferredBackBufferWidth = 1280;
			graphics.PreferredBackBufferHeight = 720;

			// Create the screen manager component.
			screenManager = new ScreenManager(this);
			spriteManager = new SpriteManager(this);
			Components.Add(screenManager);
			Components.Add(spriteManager);

			// Activate the first screens.
			screenManager.AddScreen(new BackgroundScreen(), null);
			screenManager.AddScreen(new MainMenuScreen(), null);

			//Make the mouse pointer visible in the game window
			this.IsMouseVisible = true;
		}


		/// <summary>
		/// Loads graphics content.
		/// </summary>
		protected override void LoadContent()
		{
			foreach (string asset in preloadAssets)
			{
				Content.Load<object>(asset);
			}
		}


		#endregion

		#region Draw


		/// <summary>
		/// This is called when the game should draw itself.
		/// </summary>
		protected override void Draw(GameTime gameTime)
		{
			graphics.GraphicsDevice.Clear(Color.Black);

			// The real drawing happens inside the screen manager component.
			base.Draw(gameTime);
		}


		#endregion
	}


	#region Entry Point

	/// <summary>
	/// The main entry point for the application.
	/// </summary>
	static class Program
	{
		static void Main()
		{
			using (GameStateManagementGame game = new GameStateManagementGame())
			{
				game.Run();
			}
		}
	}

	#endregion
}
